<?php
declare (strict_types=1);

namespace app\model;

use think\Model;

/**
 * @mixin Model
 */
class Loan extends Model
{
    //
    protected $json = ['goods_list', 'voucher'];

    public function getStatusTextAttr($val, $data)
    {
        $text = [-1 => '已拒绝', 0 => '待审核', 1 => '已通过', 2 => '已归还'];
        return $text[$data['status']];
    }

    public function user()
    {
        return $this->hasOne(Users::class, 'id', 'user_id');
    }

    public function verify_user()
    {
        return $this->hasOne(Users::class, 'id', 'verify_user_id');
    }
}
